package com.ws.test03;

import java.util.Objects;
import java.util.Scanner;

/**
 * @author 王硕
 * @version jdk21
 * @className Test
 * @description
 * @date 2024/11/22 15:28
 */
public class Test {
    public static void main(String[] args) {
        Computer[] computers = new Computer[3];
        computers[0] = new Computer();
        computers[0].setBrand("华为");
        computers[0].setPrice(80000);
        computers[1] = new Computer();
        computers[1].setBrand("联想");
        computers[1].setPrice(6001);
        computers[2] = new Computer();
        computers[2].setBrand("小米");
        computers[2].setPrice(5000);
        for (Computer computer : computers) {
            System.out.println(computer);
        }
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入品牌：");
        String inputBrand = scanner.nextLine();
        for (Computer computer : computers) {
            if (Objects.equals(inputBrand,computer.getBrand())){
                System.out.println(computer);
            }
        }
        System.out.println("___________________");
        for (Computer computer : computers) {
            if (computer.getPrice()>6000){
                System.out.println(computer);
            }
        }
    }
}
